package artifacts;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import javax.swing.Timer;
import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import cartago.*;

public class TestArt extends Artifact {

	private DefaultListModel model = new DefaultListModel();
	private boolean checking;
	private int aux = 0;

	void init(){
		defineObsProperty("newDocument",-1);
		checking = false;
	}

	@OPERATION void start(String vacio){
		checking = true;
		this.execInternalOp("checkingProcess",vacio);
	}

	@OPERATION void stop(){
		checking = false;
	}

	@INTERNAL_OPERATION void checkingProcess(String vacio)
	{
		while (checking){
			ObsProperty prop = getObsProperty("newDocument");
			aux++;
			prop.updateValue(aux);
			JOptionPane.showMessageDialog(null, "prop: " + prop);
			await_time(5000);
		}
	}
}